package org.carabiner.harness;

import java.awt.Component;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;

import org.carabiner.infopanel.Inspector;

/**
 * Base interface for a test harness. Harnesses display GUI controls and other
 * information about the control.
 * 
 * <p>
 * Copyright: <a href="http://www.gnu.org/licenses/gpl.html">GNU Public License</a>
 * </p>
 * 
 * @author Ben Rady (benrady@gmail.com)
 * 
 */
public interface Harness
{
  /**
   * Called to display the harness (along with the component it's testing). This should
   * be called from the GUI thread. 
   */
  public void showHarness();

  /**
   * Hides the harness and releases any resources
   */
  public void dispose();

  /**
   * Adds a new button to the button gutter at the botton of the harness. This
   * can be very useful when you need to change some state in order to fully
   * test a control.
   * 
   * @param action
   *          Action
   */
  public void addTesterAction(Action action);

  /**
   * Gets the inspector used to generate warnings for the control.
   * 
   * @return
   */
  public Inspector getInspector();

  /**
   * Gets the Component being tested. Note that this may actually be a Window
   *  
   * @return
   */
  public Component getTestSubject();

  /**
   * Gets the currently selected Component, or null if none selected
   * 
   * @return
   */
  public Component getSelectedComponent();

  /**
   * Adds a panel to the main carabiner harness window.
   *  
   */
  public void addInfoPanel(String name, JComponent infoPanel, Icon icon);
}
